import { defineStore } from "pinia";
import { store } from "@/store";
import { useStorage } from "@vueuse/core";
export const useSystemStore = defineStore("system", () => {
	// state
	const isShowfeed = ref<boolean>(false); 
	const clientX = ref<number>();
	const clientY = ref<number>();
	const feedQueItem = ref<any>();   //问题反馈内容
	const isShowFeedques = ref<boolean>(false);  //是否显示问题反馈
	const newTalk = ref<any>({});   //新建会话内容
	const isNewSess = ref<boolean>(true); //是否新建对话
	const inSessionId = ref<number>(0);  //当前会话ID
	const isNone = ref<boolean>(true);   //是否有会话记录
	const sessionlist = ref<any>([]);    //会话列表
	const keyword = ref<string>();     //搜索关键词
	const isRegin = ref<boolean>(false);  //是否重新生成
	const isShowLeft = ref<boolean>(false);  //是否显示左侧列表
	const listLoad = ref<boolean>(false);   //列表分页加载
	const noMoreDataList = ref<boolean>(false);  //暂无更多数据
	const listpage = ref<number>(1);
	const isSwich = ref<boolean>(false);  //是否切换会话
	const talkLoad = ref<boolean>(false);   //会话分页加载
	const noMoreDataTalk = ref<boolean>(false);  //暂无更多数据
	const isRefresh = ref<boolean>(false);   //是否刷新数据
	const talkpage = ref<number>(1);
	const isNohistory = ref<boolean>(false);
	const isEnterLoad = ref<boolean>(false);  //按钮loading
	const isWord = ref<boolean>(false);
	const isShowUer = ref<boolean>(false);
	const isMobile = ref<boolean>(false);
	const isCurrenDel = ref<boolean>(false);
	const guideLeft = ref<boolean>(false);
	const guideTop = ref<boolean>(false);
	const guideIndex = ref<boolean>(0);
	const isActivefeed = ref<boolean>(false);
	const isShowGuide = ref<boolean>(false);
	const isShowNav = ref<boolean>(false);
	const isAxiosTwo = ref<boolean>(false);  //是否在进行第二步
	const isCreatLoad = ref<boolean>(false);  //正在请求会话
	const isFetEnd = ref<boolean>(false);  //正在请求会话
	const listCount = ref<number>(50);  //正在请求会话
	const productClassid = ref<number>();
	const isplayaudio = ref<boolean>(true);
	const isMessageType =ref<number>(0);//消息通知信息 0不显示 1为个人消息 2企业消息
	const sessionType = ref<number>(0); //会话类型 0新会话 1 正在会话 2.计算器
	const isHaiRule = ref<boolean>(false); //是否使用海南政策
	const isRuleUsed = ref<boolean>(false); //是否成功使用
	const wordname = ref<string>();
	const conversation_id = ref<string>();
	const isCommand = ref<boolean>(false); //是否是指令
	const curCommand = ref<any>()
	const aiboxShow = ref<boolean>(false); //是否显示ai
	function toggleShowfeed(){
        isShowfeed.value = !isShowfeed.value;
    }
	const selectChildItem = ref<any>(); //选中插件
	const selectedPlug = ref<any>([]);//选择的插件
	const isPlug = ref<boolean>(false); //是否选择插件了
	const isPlugClick = ref<boolean>(false); //是否选择插件了
	
	return {
		conversation_id,
		isPlugClick,
		selectedPlug,
		isPlug,
		selectChildItem,
		aiboxShow,
		curCommand,
		isCommand,
		isShowfeed,
        toggleShowfeed,
		clientY,
		feedQueItem,
		isShowFeedques,
		newTalk,
		isNewSess,
		inSessionId,
		isNone,
		keyword,
		isRegin,
		isShowLeft,
		sessionlist,
		clientX,
		listLoad,
		noMoreDataList,
		listpage,
		isSwich,
		talkLoad,
		noMoreDataTalk,
		isRefresh,
		talkpage,
		isNohistory,
		isEnterLoad,
		isWord,
		isShowUer,
		isMobile,
		isCurrenDel,
		guideLeft,
		guideTop,
		guideIndex,
		isActivefeed,
		isShowGuide,
		isShowNav,
		isAxiosTwo,
		isCreatLoad,
		isFetEnd,
		listCount,
		productClassid,
		isplayaudio,
		sessionType,
		isHaiRule,
		isRuleUsed,
		wordname
	};
},{
	persist: {
		key: 'systemStore', 
		storage: localStorage, 
		paths: ['feedQueItem','isRegin','isFetEnd','productClassid','isplayaudio','wordname'],
	},
});